module klang.编译.诊断.诊断_;
import 全局;
import klang.编译.核心.核心_: 整数_;
enum 诊断类别_ : int {
    Warning = 0,
    Error = 1,
    Suggestion = 2,
    Message = 3
}
class 诊断消息_ {
    dstring 键;
    诊断类别_ 诊断类别;
    long 代码;
    dstring 消息;
    /* @internal */
    bool 在相容性上被省略;
    this() { }
    this(dstring 键, 诊断类别_ 诊断类别, long 代码, dstring 消息, bool 在相容性上被省略) {
        this.键 = 键;
        this.诊断类别 = 诊断类别;
        this.代码 = 代码;
        this.消息 = 消息;
        this.在相容性上被省略 = 在相容性上被省略;
    }
}
/**
 * A linked list of formatted 诊断_ messages to be used as part of a multiline message.
 * It is built from the bottom up, leaving the head to be the "main" 诊断_.
 * While it seems that 诊断消息_链_ is structurally similar to 诊断消息_,
 * the difference is that messages are all preformatted in DMC.
 */
class 诊断消息_链_ {
    dstring 消息文本;
    诊断类别_ 诊断类别;
    long 代码;
    诊断消息_链_[] 下个;
    this() { }
    this(dstring 消息文本, 诊断类别_ _诊断类别 = 诊断类别_.Error, long _代码 = 0) {
        this.消息文本 = 消息文本;
        this.诊断类别 = _诊断类别;
        this.代码 = _代码;
        this.下个 = ··null!(诊断消息_链_[]);
    }
}
class 诊断_ : 诊断相关信息_ {
    dstring source;
    诊断相关信息_[] 相关信息组;
    this() { }
    this(诊断类别_ category, long code, dstring 消息文本, dstring source = ··null!(dstring), 诊断相关信息_[] 相关信息组 = ··null!(诊断相关信息_[])) {
        super(category, code, new 诊断消息_链_(消息文本, category, code));
        this.source = source;
        this.相关信息组 = 相关信息组;
    }
    this(诊断类别_ category, long code, 诊断消息_链_ 消息文本, dstring source = ··null!(dstring), 诊断相关信息_[] 相关信息组 = ··null!(诊断相关信息_[])) {
        super(category, code, 消息文本);
        this.source = source;
        this.相关信息组 = 相关信息组;
    }
    this(诊断相关信息_ diag, dstring source = ··null!(dstring), 诊断相关信息_[] 相关信息组 = ··null!(诊断相关信息_[])) {
        super(diag.诊断类别, diag.代码, diag.消息文本);
        this.source = source;
        this.相关信息组 = 相关信息组;
    }
}
class 诊断相关信息_ {
    诊断类别_ 诊断类别;
    long 代码;
    Object 文件;
    long 起点;
    long 长;
    诊断消息_链_ 消息文本;
    this() { }
    this(诊断类别_ category, long code, 诊断消息_链_ 消息文本) {
        this.诊断类别 = category;
        this.代码 = code;
        this.文件 = ··null!(Object);
        this.消息文本 = 消息文本;
        this.起点 = 0;
        this.长 = 0;
    }
}
class 诊断包括位置_ : 诊断_ {
    this() { }
    this(Object file, long 起点, long 长, 诊断类别_ category, long code, dstring 消息文本, dstring source = ··null!(dstring), 诊断相关信息_[] 相关信息组 = ··null!(诊断相关信息_[])) {
        super(category, code, 消息文本, source, 相关信息组);
        this.文件 = file;
        this.起点 = 起点;
        this.长 = 长;
    }
    this(Object file, long 起点, long 长, 诊断_ diag) {
        super(diag, diag.source, diag.相关信息组);
        this.文件 = file;
        this.起点 = 起点;
        this.长 = 长;
    }
}
诊断消息_ diag(long _code, 诊断类别_ _category, dstring _key, dstring _message, bool _elidedInCompatabilityPyramid = false) {
    return new 诊断消息_(_key, _category, _code, _message, _elidedInCompatabilityPyramid);
}
void concatenateDiagnosticMessageChains(诊断消息_链_ headChain, 诊断消息_链_ tailChain) {
    诊断消息_链_ lastChain = headChain;
    while(lastChain.下个 !is ··null!(诊断消息_链_[])) {
        lastChain = lastChain.下个[0];
    }
    lastChain.下个 = [tailChain];
}
